package com.simu.towercrane.activity;
import com.simu.towercrane.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.view.Window;

import com.baidu.navisdk.BNaviPoint;
import com.baidu.navisdk.BaiduNaviManager;
import com.baidu.navisdk.BNaviEngineManager.NaviEngineInitListener;
import com.baidu.navisdk.BaiduNaviManager.OnStartNavigationListener;
import com.baidu.navisdk.comapi.routeplan.RoutePlanParams.NE_RoutePlan_Mode;

public class RouteGuideDemo extends Activity{
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main_baidu);
		Intent intent=getIntent();
		double startlatitude=Double.valueOf(intent.getStringExtra("startlatitude")).doubleValue();
		double startlongitude=Double.valueOf(intent.getStringExtra("startlongitude")).doubleValue();
		double endlatitude=Double.valueOf(intent.getStringExtra("endlatitude")).doubleValue();
		double endlongitude=Double.valueOf(intent.getStringExtra("endlongitude")).doubleValue();
		
		String startName=intent.getStringExtra("startName");
		String endNamge=intent.getStringExtra("endNamge");
	
		
		
		launchNavigator2(startlatitude,startlongitude,endlatitude,endlongitude,startName,endNamge,intent);
	}



	private void launchNavigator2(double startlatitude, double startlongitude, double endlatitude, double endlongitude, String startName, String endNamge, Intent intent){  
	    BNaviPoint startPoint = new BNaviPoint(30.0,103.5,  
	    		startName, BNaviPoint.CoordinateType.BD09_MC); 
	   
	    BNaviPoint endPoint = new BNaviPoint(30.0,103.0,  
	    		endNamge, BNaviPoint.CoordinateType.BD09_MC);  
	    BaiduNaviManager.getInstance().launchNavigator(this,  
	        startPoint,                            //��㣨��ָ�����ϵ��  
	        endPoint,                              //�յ㣨��ָ�����ϵ��  
	        NE_RoutePlan_Mode.ROUTE_PLAN_MOD_MIN_TIME,//��·��ʽ  
	        true,                                            //��ʵ����  
	        BaiduNaviManager.STRATEGY_FORCE_ONLINE_PRIORITY,   
	        new OnStartNavigationListener(){

				@Override
				public void onJumpToDownloader() {
					// TODO Auto-generated method stub
					
				}

				@Override
				public void onJumpToNavigator(Bundle info) {
					// TODO Auto-generated method stub
					Intent intent = new Intent();  
					intent.setClass(RouteGuideDemo.this, BNavigatorActivity.class);
                    intent.putExtras(info);  
                    startActivity(intent);  
					
				}
	    	
	    }
	        );  
	}
}
